home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / Tool Chest / Testing & Debugging / Mac OS Development Toolkit / Automation Essentials 2.3.0 / • Other Stuff / Scripting Aids / Script Templates / BuildListFromResource next >
Encoding:
Text File  |  1998-03-19  |  1.4 KB  |  34 lines  |  [TEXT/MPS ]

  1. #########################################################################
  2. #                        BuildListFromResourceMacDraw( idNum )
  3. #========================================================================
  4. # Author:        KTA 
  5. # Description:    Returns a list generated from all of the strings in a specified
  6. #                string list resource specified by <idNum>.
  7. # Parameters:    idNum := resource id number for the string list resource.
  8. # Returns:        list - all strings in specified string list resource.
  9. # Examples:        BuildListFromResource( 201 ); 
  10. # Assumptions:    This task must be contained within the same file that contains
  11. #                the resources. Currently this task only supports up to 100 strings
  12. #                in a single str# resource.
  13. # Note:            The naming convension is to append the name
  14. #                of the application under test to the end of the task name.
  15. #                For example, BuildListFromResourceMacDraw()
  16. #========================================================================
  17. # History:
  18. #
  19. #########################################################################
  20. task BuildListFromResourceMacDraw(idNum)
  21. begin
  22.     numtimes := 100;    #Assumes no resource will contain more than 100 strings
  23.     theList := {};
  24.     for i := 1 to numtimes
  25.     begin
  26.         CurrentFont := GetIndString(idNum,i);
  27.         if (isUndefined(CurrentFont))
  28.             numtimes := i;
  29.         else
  30.             theList := Insert(CurrentFont,Card(theList)+1, theList);
  31.     end;
  32.     return(theList);
  33. end; # BuildListFromResourceMacDraw
  34.